Result:Mate 19", "puzzleFenStart" : "8/8/3k4/8/3K4/8/3P4/8 w - - 9 1", "puzzleMoves" : "", "puzzleVariations" : " ", "puzzleSolutionComment" : "King two square in front of pawn = win. An easy way to remember the key squares is to note that if the pawn is not beyond the midpoint of the board, there are three key squares that are two ranks ahead. If the pawn is on the fifth or sixth rank there are six key squares on the two ranks in front of the pawn. If the pawn is on the seventh rank, the adjoining squares on the seventh and eighth ranks are key squares", "firstMoveEnable" : "false"},
{ "puzzleTitle" : "#2 - Pawn Endgame Class D - Silman endgame", "puzzleInfo" : " White to play = draw (black king will use the opposition to block white king). Black to play = white win ! The opposition is lost ! An easy way to remember the key squares is to note that if the pawn is not beyond the midpoint of the board, there are three key squares that are two ranks ahead. If the pawn is on the fifth or sixth rank there are six key squares on the two ranks in front of the pawn. If the pawn is on the seventh rank, the adjoining squares on the seventh and eighth ranks are key squares Result:Draw", "puzzleFenStart" : "8/3k4/8/2K5/3P4/8/8/8 b - - 10 1", "puzzleMoves" : "", "puzzleVariations" : " ", "puzzleSolutionComment" : "White to play = draw (black king will use the opposition to block white king). Black to play = white win ! The opposition is lost ! An easy way to remember the key squares is to note that if the pawn is not beyond the midpoint of the board, there are three key squares that are two ranks ahead. If the pawn is on the fifth or sixth rank there are six key squares on the two ranks in front of the pawn. If the pawn is on the seventh rank, the adjoining squares on the seventh and eighth ranks are key squares", "firstMoveEnable" : "false"},
{ "puzzleTitle" : "#3 - Pawn Endgame Class D - Silman endgame", "puzzleInfo" : " To win : keep the opposition. The square betwin the king and the pawn allow white king to use a xainting move to keep opposition. An easy way to remember the key squares is to note that if the pawn is not beyond the midpoint of the board, there are three key squares that are two ranks ahead. If the pawn is on the fifth or sixth rank there are six key squares on the two ranks in front of the pawn. If the pawn is on the seventh rank, the adjoining squares on the seventh and eighth ranks are key squares Result:Mate 16", "puzzleFenStart" : "8/3k4/8/4K3/8/4P3/8/8 w - - 9 1", "puzzleMoves" : "", "puzzleVariations" : " ", "puzzleSolutionComment" : "To win : keep the opposition. The square betwin the king and the pawn allow white king to use a xainting move to keep opposition. An easy way to remember the key squares is to note that if the pawn is not beyond the midpoint of the board, there are three key squares that are two ranks ahead. If the pawn is on the fifth or sixth rank there are six key squares on the two ranks in front of the pawn. If the pawn is on the seventh rank, the adjoining squares on the seventh and eighth ranks are key squares", "firstMoveEnable" : "false"},
{ "puzzleTitle" : "#4 - Knight Pawn Class D - Silman endgame", "puzzleInfo" : " White to move Don’t allow the black king to go to a draw on a8. Target : keep the « a » column with the white king Result:Mate 20", "puzzleFenStart" : "8/8/2k5/8/KP6/8/8/8 w - - 9 1", "puzzleMoves" : "", "puzzleVariations" : " ", "puzzleSolutionComment" : "White to move Don’t allow the black king to go to a draw on a8. Target : keep the « a » column with the white king ", "firstMoveEnable" : "false"},
{ "puzzleTitle" : "#5 - Fox in the chicken coup Class D - Silman endgame", "puzzleInfo" : " The stronger King (Fox) feast on helpness enemy pawns (chickens) while the defending King is busy dealing with a pawn on other king. Result:Mate 18", "puzzleFenStart" : "8/8/1k3p2/5Pp1/KP4P1/8/8/8 w - - 9 1", "puzzleMoves" : "", "puzzleVariations" : " ", "puzzleSolutionComment" : "The stronger King (Fox) feast on helpness enemy pawns (chickens) while the defending King is busy dealing with a pawn on other king. ", "firstMoveEnable" : "false"},
{ "puzzleTitle" : "#6 - one pawn kill two Class D - Silman endgame", "puzzleInfo" : " Don’t allow your pawn majority to be frozen in it’s track by a smaller number of enemy pawns Result:Draw", "puzzleFenStart" : "8/8/2k3p1/1p6/1K6/6PP/8/8 w - - 0 1", "puzzleMoves" : "", "puzzleVariations" : " ", "puzzleSolutionComment" : "Don’t allow your pawn majority to be frozen in it’s track by a smaller number of enemy pawns ", "firstMoveEnable" : "false"},
{ "puzzleTitle" : "#7 - Knight Vs alone Pawn Class D - Silman endgame", "puzzleInfo" : " Rule : If the Knight can safely land on (or keep connected to) the square (or squares, if the pawn isn’t on the 7th rank) in front of the pawn, the game will be drawn (a rook-pawn being the one case where exceptions might occur). Remember : If the Knight can safely land on the square in front of the pawn, the game will be draw. A lone Knight can only triumph over a lone pawn if that pawn is a rook-pawn and if its King is trapped in front of it. Why ? Because, in certain rare instances, the rook-pawn allows smother mates occur. Result:Draw", "puzzleFenStart" : "7K/8/2N5/8/8/2pk4/8/8 w - - 9 1", "puzzleMoves" : "", "puzzleVariations" : " ", "puzzleSolutionComment" : "Rule : If the Knight can safely land on (or keep connected to) the square (or squares, if the pawn isn’t on the 7th rank) in front of the pawn, the game will be drawn (a rook-pawn being the one case where exceptions might occur). Remember : If the Knight can safely land on the square in front of the pawn, the game will be draw. A lone Knight can only triumph over a lone pawn if that pawn is a rook-pawn and if its King is trapped in front of it. Why ? Because, in certain rare instances, the rook-pawn allows smother mates occur.", "firstMoveEnable" : "false"},
{ "puzzleTitle" : "#8 - Rook Vs lone Pawn Class D - Silman endgame", "puzzleInfo" : " Rules :
If the enemy pawn is well into its journey towards promotion, and if its King is helping, and if the rook’s King is off on vacation, then a draw will result.
A pawn on the 5th rank and a king trapped on the 3rd rank by the enemy rook is always a win for the side with the rook.
Idea : lock the white king. The pawn is lost because if it want go to the 8th rank, rook have enough time to capture it without king protection. Result:Mate 20", "puzzleFenStart" : "8/8/8/6P1/8/5K2/1r6/k7 b - - 9 1", "puzzleMoves" : "", "puzzleVariations" : " ", "puzzleSolutionComment" : "Rules :
If the enemy pawn is well into its journey towards promotion, and if its King is helping, and if the rook’s King is off on vacation, then a draw will result.
A pawn on the 5th rank and a king trapped on the 3rd rank by the enemy rook is always a win for the side with the rook.
Idea : lock the white king. The pawn is lost because if it want go to the 8th rank, rook have enough time to capture it without king protection.", "firstMoveEnable" : "false"},
{ "puzzleTitle" : "#9 - Short Side/long side defense Class D - Silman endgame", "puzzleInfo" : " Defend white position - King from short side, Rook on long side (rook will make continious check will King try to take the pawn) White play king to short side and rook to h8 (long side) Result:draw", "puzzleFenStart" : "7R/8/8/8/2p5/2k5/K7/2r5 w - - 9 1", "puzzleMoves" : "", "puzzleVariations" : " ", "puzzleSolutionComment" : "Defend white position - King from short side, Rook on long side (rook will make continious check will King try to take the pawn) White play king to short side and rook to h8 (long side)", "firstMoveEnable" : "false"},
{ "puzzleTitle" : "#10 - King & Pawn VS Lone King Class C - Silman endgame", "puzzleInfo" : " If the stronger side’s king gets one square in front of it’s pawn, the result of the game depends on who has the opposition unless one of two exceptions are present :
The game is a draw if the pawn is a rook-pawn.
If a non rook-pawn is on the 5th rank and its king is on the 6 th rank, taking the opposition won’t save the defender.
White to move = win | Black to move = draw (depends on who has the opposition) : Result:Mate 22", "puzzleFenStart" : "4k3/8/8/8/8/8/4P3/4K3 w - - 9 1", "puzzleMoves" : "", "puzzleVariations" : " ", "puzzleSolutionComment" : "If the stronger side’s king gets one square in front of it’s pawn, the result of the game depends on who has the opposition unless one of two exceptions are present :
The game is a draw if the pawn is a rook-pawn.
If a non rook-pawn is on the 5th rank and its king is on the 6 th rank, taking the opposition won’t save the defender.
White to move = win | Black to move = draw (depends on who has the opposition) :", "firstMoveEnable" : "false"},
{ "puzzleTitle" : "#11 - King and Two Doubled pawns vs. Lone King Class C - Silman endgame", "puzzleInfo" : " If the the paws are healthy and not rook-pawns, King and 2 doubled pawns win Result:Mate 15", "puzzleFenStart" : "8/8/6k1/8/6P1/6K1/6P1/8 w - - 3 4", "puzzleMoves" : "", "puzzleVariations" : " ", "puzzleSolutionComment" : "If the the paws are healthy and not rook-pawns, King and 2 doubled pawns win ", "firstMoveEnable" : "false"},
{ "puzzleTitle" : "#12 - Lone King vs Knight and Rook-Pawn on the 6th or 7th Class C - Silman endgame", "puzzleInfo" : " Rule : A knight and a safe pawn vs. A lone King is always a win for the material advantage, except when the extra pawn is a rook-pawn and that rook-pawn is on the 7th rank. Target : use the pawn promotion threat black to move = >draw Useful advice :
when you have to guard your pawn with your knight in this kind of endgame, it’s usually correct to defend the pawn from behind and not from the front or the side. Why ? Because an undefendede Knight on the side or front allow the defending King to capture it and still be in a position where the pawn can be stopped. Capturing a Knight that’s behind it’s pawn allow the pawn to turn into a Queen.
You can win the position by taking control of the queening square with the Knight.
Strategy : white rook while protected the pawn promotion and block black king. The white king attack the black rook . White king plan : walking to the 1st rank to attack the black king and zigzag to the rook and never go in front og the pawn (and first protect the pawn) → Kc6 Result:Mate 16", "puzzleFenStart" : "6k1/8/7P/1K2N3/8/8/8/8 w - - 0 1", "puzzleMoves" : "", "puzzleVariations" : " ", "puzzleSolutionComment" : "Rule : A knight and a safe pawn vs. A lone King is always a win for the material advantage, except when the extra pawn is a rook-pawn and that rook-pawn is on the 7th rank. Target : use the pawn promotion threat black to move = >draw Useful advice :
when you have to guard your pawn with your knight in this kind of endgame, it’s usually correct to defend the pawn from behind and not from the front or the side. Why ? Because an undefendede Knight on the side or front allow the defending King to capture it and still be in a position where the pawn can be stopped. Capturing a Knight that’s behind it’s pawn allow the pawn to turn into a Queen.
You can win the position by taking control of the queening square with the Knight.
Strategy : white rook while protected the pawn promotion and block black king. The white king attack the black rook . White king plan : walking to the 1st rank to attack the black king and zigzag to the rook and never go in front og the pawn (and first protect the pawn) → Kc6", "firstMoveEnable" : "false"},
{ "puzzleTitle" : "#13 - Lucena Position Class C - Silman endgame", "puzzleInfo" : " Position : King + Rook VS non rook-pawn + King + Rook. White king is on 8th rank back the pawn in 7th rank and white King canno’t move. Steps :
Force the black King away from the action (ex. : Rf2).
Prepare to use as a check-blocking (« bridge building ») (ex. : Rf4). Put the rook on the 4th rank. Prepare to move the king and support attack (in front of the white king to attack black rook or to support pawn promotion)
Move your king away from the front of the pawn.
Block the opponent’s desperate checks with the rook, wich effectively ends the game.
Result:Mate 19", "puzzleFenStart" : "3K4/3P1k2/8/8/8/8/4R3/2r5 w - - 9 1", "puzzleMoves" : "", "puzzleVariations" : " ", "puzzleSolutionComment" : "Position : King + Rook VS non rook-pawn + King + Rook. White king is on 8th rank back the pawn in 7th rank and white King canno’t move. Steps :
Force the black King away from the action (ex. : Rf2).
Prepare to use as a check-blocking (« bridge building ») (ex. : Rf4). Put the rook on the 4th rank. Prepare to move the king and support attack (in front of the white king to attack black rook or to support pawn promotion)
Move your king away from the front of the pawn.
Block the opponent’s desperate checks with the rook, wich effectively ends the game.
", "firstMoveEnable" : "false"},
{ "puzzleTitle" : "#14 - Lucena Position Puzzle - John Bathelomew", "puzzleInfo" : " Position : King + Rook VS non rook-pawn + King + Rook. White king is on 8th rank back the pawn in 7th rank and white King canno’t move. Steps :
Force the black King away from the action (ex. : Rf2).
Prepare to use as a check-blocking (« bridge building ») (ex. : Rf4). Put the rook on the 4th rank. Prepare to move the king and support attack (in front of the white king to attack black rook or to support pawn promotion)
Move your king away from the front of the pawn.
Block the opponent’s desperate checks with the rook, wich effectively ends the game.
Result:Mate 15", "puzzleFenStart" : "8/1P2k3/1K6/8/3R4/8/1r6/8 w - - 6 4", "puzzleMoves" : "Kc6 Rc2+ Kb5 Rb2+ Rb4 Rxb4+ Kxb4 Kd7 b8=Q", "puzzleVariations" : " ", "puzzleSolutionComment" : "Position : King + Rook VS non rook-pawn + King + Rook. White king is on 8th rank back the pawn in 7th rank and white King canno’t move. Steps :
Force the black King away from the action (ex. : Rf2).
Prepare to use as a check-blocking (« bridge building ») (ex. : Rf4). Put the rook on the 4th rank. Prepare to move the king and support attack (in front of the white king to attack black rook or to support pawn promotion)
Move your king away from the front of the pawn.
Block the opponent’s desperate checks with the rook, wich effectively ends the game.
", "firstMoveEnable" : "false"},
{ "puzzleTitle" : "#15 - Lucena Position Puzzle 2 - John Bathelomew", "puzzleInfo" : " Position : King + Rook VS non rook-pawn + King + Rook. White king is on 8th rank back the pawn in 7th rank and white King canno’t move. Steps :
Force the black King away from the action (ex. : Rf2).
Prepare to use as a check-blocking (« bridge building ») (ex. : Rf4). Put the rook on the 4th rank. Prepare to move the king and support attack (in front of the white king to attack black rook or to support pawn promotion)
Move your king away from the front of the pawn.
Block the opponent’s desperate checks with the rook, wich effectively ends the game.
Result:Mate", "puzzleFenStart" : "1K6/1P6/8/4k3/3R4/8/8/r7 w - - 6 4", "puzzleMoves" : "Rb4 Kd6 Kc8 Rc1+ Kd8", "puzzleVariations" : " ", "puzzleSolutionComment" : "Position : King + Rook VS non rook-pawn + King + Rook. White king is on 8th rank back the pawn in 7th rank and white King canno’t move. Steps :
Force the black King away from the action (ex. : Rf2).
Prepare to use as a check-blocking (« bridge building ») (ex. : Rf4). Put the rook on the 4th rank. Prepare to move the king and support attack (in front of the white king to attack black rook or to support pawn promotion)
Move your king away from the front of the pawn.
Block the opponent’s desperate checks with the rook, wich effectively ends the game.
", "firstMoveEnable" : "false"},
{ "puzzleTitle" : "#16 - Lucena Position Error - Hanging Pawns", "puzzleInfo" : " Black Error after Rg2 Result:Mate 19", "puzzleFenStart" : "4K3/4P3/5k2/8/8/8/6R1/r7 w - - 10 1", "puzzleMoves" : "Kf8 Ra8+ e8=Q Rxe8+ Kxe8", "puzzleVariations" : " ", "puzzleSolutionComment" : "Black Error after Rg2", "firstMoveEnable" : "false"},
{ "puzzleTitle" : "#17 - Philidor Position – Draw Class C - Silman endgame", "puzzleInfo" : " Position : King in front of the ennemy pawn. Though a Philidor position shoud be drawn, things can turn ugly if the defender’s rook becomes passively placed. Silman Useful advice :
The idea of swinging the Rook over the other side is worth remembering since you’ll be able to make use of it again and again during th course of your chess career.
The idea of blocking checks by using the pawn and cover is a big one, and black must do his best to avoid pitfall.
Trapping defensive King away from the action for either defensive or effensives reasons is often a very effective strategy.
Silman rules :
If you defend a Philidor position, don’t allow your Rook to become passively placed
If your opponent’s extra pawn is a knight-pawn or rook-pawn and your king is in front of it, you should effortlessly draw evn if the lobotomy scar hasn’t completely healed yet.
The defender’s drawing plan in Philidor position is to use his Rook to block the stronger side’s King from stepping onto the rank in front of the pawn. Go back and forth with the Rook until the pawn is pushed (destroying the ennemy King’s pawn cover). Then leap to the back rank (putting maximum distance between the defending Rook and enemy King) and begin checking like a berserk demon.
Philidor = draw ? Passive rook Black idea : perpetual check with black rook on the 1st rank. White idea :
use the pawn and the rook to stop perpetual check.
Pawn promotion : use rook and King to mate.
Result:Draw", "puzzleFenStart" : "6R1/4k2r/8/3KP3/8/8/8/8 b - - 9 1", "puzzleMoves" : "", "puzzleVariations" : " ", "puzzleSolutionComment" : "Position : King in front of the ennemy pawn. Though a Philidor position shoud be drawn, things can turn ugly if the defender’s rook becomes passively placed. Silman Useful advice :
The idea of swinging the Rook over the other side is worth remembering since you’ll be able to make use of it again and again during th course of your chess career.
The idea of blocking checks by using the pawn and cover is a big one, and black must do his best to avoid pitfall.
Trapping defensive King away from the action for either defensive or effensives reasons is often a very effective strategy.
Silman rules :
If you defend a Philidor position, don’t allow your Rook to become passively placed
If your opponent’s extra pawn is a knight-pawn or rook-pawn and your king is in front of it, you should effortlessly draw evn if the lobotomy scar hasn’t completely healed yet.
The defender’s drawing plan in Philidor position is to use his Rook to block the stronger side’s King from stepping onto the rank in front of the pawn. Go back and forth with the Rook until the pawn is pushed (destroying the ennemy King’s pawn cover). Then leap to the back rank (putting maximum distance between the defending Rook and enemy King) and begin checking like a berserk demon.
Philidor = draw ? Passive rook Black idea : perpetual check with black rook on the 1st rank. White idea :
use the pawn and the rook to stop perpetual check.
Pawn promotion : use rook and King to mate.
", "firstMoveEnable" : "false"},
{ "puzzleTitle" : "#18 - Philidor Position – Draw - Hanging Pawns", "puzzleInfo" : " Result:Draw", "puzzleFenStart" : "4k3/R7/8/7r/8/8/3KP3/8 b - - 1 1", "puzzleMoves" : "", "puzzleVariations" : " ", "puzzleSolutionComment" : "", "firstMoveEnable" : "false"},
{ "puzzleTitle" : "#19 - Philidor Position Class C - Silman endgame", "puzzleInfo" : " Result:Mate 11", "puzzleFenStart" : "3k2r1/7R/2KP4/8/8/8/8/8 w - - 9 1", "puzzleMoves" : "", "puzzleVariations" : " ", "puzzleSolutionComment" : "", "firstMoveEnable" : "false"},
{ "puzzleTitle" : "#20 - Queen vs d Pawn Class C - Silman endgame", "puzzleInfo" : " Queen vs Pawn on the 6th Rank Rule : Lone Queen vs King and pawn on the 6th rank is almost always a win for the Queen. Queen vs Pawn on the 7th Rank Rule : This endgame is won by manoeuvring with the Queen so that black’s King is forced to step in front of it’s pawn. Since the pawn can’t move for a moment, the white King can take a safe step closer to the pawn’s position. This will be repeated until white’s King joins with its Queen to pick off the pawn. Rules :
A b/g/e/d-pawn on the 7th almost lose to a Queen.
A c/f-pawn on the 7th rank can draw against a Queen if the
A rook-pawn on the 7th rank is a draw if the stronger side’s King is far from the action.
Astuces :
Mettre le roi adverse en face du pion pour avancer notre roi vers ce pion.
Mettre la Dame en face du pion et avancer notre roi vers le pion.
Rapprocher notre roi du pion.
Utiliser le clouage du pion
Rapprocher notre roi du pion.
Mettre la Dame dans la diagonale arrière du pion avec un échec pour forcer le roi adverse à avancer vers le pion
Result:5773", "puzzleFenStart" : "3K2Q1/8/8/8/8/5k2/3p4/8 w - - 9 1", "puzzleMoves" : "", "puzzleVariations" : " ", "puzzleSolutionComment" : "Queen vs Pawn on the 6th Rank Rule : Lone Queen vs King and pawn on the 6th rank is almost always a win for the Queen. Queen vs Pawn on the 7th Rank Rule : This endgame is won by manoeuvring with the Queen so that black’s King is forced to step in front of it’s pawn. Since the pawn can’t move for a moment, the white King can take a safe step closer to the pawn’s position. This will be repeated until white’s King joins with its Queen to pick off the pawn. Rules :
A b/g/e/d-pawn on the 7th almost lose to a Queen.
A c/f-pawn on the 7th rank can draw against a Queen if the
A rook-pawn on the 7th rank is a draw if the stronger side’s King is far from the action.
Astuces :
Mettre le roi adverse en face du pion pour avancer notre roi vers ce pion.
Mettre la Dame en face du pion et avancer notre roi vers le pion.
Rapprocher notre roi du pion.
Utiliser le clouage du pion
Rapprocher notre roi du pion.
Mettre la Dame dans la diagonale arrière du pion avec un échec pour forcer le roi adverse à avancer vers le pion
", "firstMoveEnable" : "false"},
{ "puzzleTitle" : "#21 - Queen vs e Pawn Class C - Chess engame Android", "puzzleInfo" : " Queen vs Pawn on the 6th Rank Rule : Lone Queen vs King and pawn on the 6th rank is almost always a win for the Queen. Queen vs Pawn on the 7th Rank Rule : This endgame is won by manoeuvring with the Queen so that black’s King is forced to step in front of it’s pawn. Since the pawn can’t move for a moment, the white King can take a safe step closer to the pawn’s position. This will be repeated until white’s King joins with its Queen to pick off the pawn. Rules :
A b/g/e/d-pawn on the 7th almost lose to a Queen.
A c/f-pawn on the 7th rank can draw against a Queen if the
A rook-pawn on the 7th rank is a draw if the stronger side’s King is far from the action.
Astuces :
Mettre le roi adverse en face du pion pour avancer notre roi vers ce pion.
Mettre la Dame en face du pion et avancer notre roi vers le pion.
Rapprocher notre roi du pion.
Utiliser le clouage du pion
Rapprocher notre roi du pion.
Mettre la Dame dans la diagonale arrière du pion avec un échec pour forcer le roi adverse à avancer vers le pion
Result:Mate 17", "puzzleFenStart" : "8/6K1/8/8/3Q4/8/4p3/2k5 w - - 0 6", "puzzleMoves" : "", "puzzleVariations" : " ", "puzzleSolutionComment" : "Queen vs Pawn on the 6th Rank Rule : Lone Queen vs King and pawn on the 6th rank is almost always a win for the Queen. Queen vs Pawn on the 7th Rank Rule : This endgame is won by manoeuvring with the Queen so that black’s King is forced to step in front of it’s pawn. Since the pawn can’t move for a moment, the white King can take a safe step closer to the pawn’s position. This will be repeated until white’s King joins with its Queen to pick off the pawn. Rules :
A b/g/e/d-pawn on the 7th almost lose to a Queen.
A c/f-pawn on the 7th rank can draw against a Queen if the
A rook-pawn on the 7th rank is a draw if the stronger side’s King is far from the action.
Astuces :
Mettre le roi adverse en face du pion pour avancer notre roi vers ce pion.
Mettre la Dame en face du pion et avancer notre roi vers le pion.
Rapprocher notre roi du pion.
Utiliser le clouage du pion
Rapprocher notre roi du pion.
Mettre la Dame dans la diagonale arrière du pion avec un échec pour forcer le roi adverse à avancer vers le pion
", "firstMoveEnable" : "false"},
{ "puzzleTitle" : "#22 - Queen vs f Pawn Class C - Chess engame Android", "puzzleInfo" : " Queen vs Pawn on the 6th Rank Rule : Lone Queen vs King and pawn on the 6th rank is almost always a win for the Queen. Queen vs Pawn on the 7th Rank Rule : This endgame is won by manoeuvring with the Queen so that black’s King is forced to step in front of it’s pawn. Since the pawn can’t move for a moment, the white King can take a safe step closer to the pawn’s position. This will be repeated until white’s King joins with its Queen to pick off the pawn. Rules :
A b/g/e/d-pawn on the 7th almost lose to a Queen.
A c/f-pawn on the 7th rank can draw against a Queen if the
A rook-pawn on the 7th rank is a draw if the stronger side’s King is far from the action.
Astuces :
Mettre le roi adverse en face du pion pour avancer notre roi vers ce pion.
Mettre la Dame en face du pion et avancer notre roi vers le pion.
Rapprocher notre roi du pion.
Utiliser le clouage du pion
Rapprocher notre roi du pion.
Mettre la Dame dans la diagonale arrière du pion avec un échec pour forcer le roi adverse à avancer vers le pion
Result:Mate 14", "puzzleFenStart" : "7Q/1K6/8/8/8/5p2/6k1/8 w - - 0 6", "puzzleMoves" : "", "puzzleVariations" : " ", "puzzleSolutionComment" : "Queen vs Pawn on the 6th Rank Rule : Lone Queen vs King and pawn on the 6th rank is almost always a win for the Queen. Queen vs Pawn on the 7th Rank Rule : This endgame is won by manoeuvring with the Queen so that black’s King is forced to step in front of it’s pawn. Since the pawn can’t move for a moment, the white King can take a safe step closer to the pawn’s position. This will be repeated until white’s King joins with its Queen to pick off the pawn. Rules :
A b/g/e/d-pawn on the 7th almost lose to a Queen.
A c/f-pawn on the 7th rank can draw against a Queen if the
A rook-pawn on the 7th rank is a draw if the stronger side’s King is far from the action.
Astuces :
Mettre le roi adverse en face du pion pour avancer notre roi vers ce pion.
Mettre la Dame en face du pion et avancer notre roi vers le pion.
Rapprocher notre roi du pion.
Utiliser le clouage du pion
Rapprocher notre roi du pion.
Mettre la Dame dans la diagonale arrière du pion avec un échec pour forcer le roi adverse à avancer vers le pion
", "firstMoveEnable" : "false"},
{ "puzzleTitle" : "#23 - Queen vs e Pawn Class C - Chess engame Android", "puzzleInfo" : " Queen vs Pawn on the 6th Rank Rule : Lone Queen vs King and pawn on the 6th rank is almost always a win for the Queen. Queen vs Pawn on the 7th Rank Rule : This endgame is won by manoeuvring with the Queen so that black’s King is forced to step in front of it’s pawn. Since the pawn can’t move for a moment, the white King can take a safe step closer to the pawn’s position. This will be repeated until white’s King joins with its Queen to pick off the pawn. Rules :
A b/g/e/d-pawn on the 7th almost lose to a Queen.
A c/f-pawn on the 7th rank can draw against a Queen if the
A rook-pawn on the 7th rank is a draw if the stronger side’s King is far from the action.
Astuces :
Mettre le roi adverse en face du pion pour avancer notre roi vers ce pion.
Mettre la Dame en face du pion et avancer notre roi vers le pion.
Rapprocher notre roi du pion.
Utiliser le clouage du pion
Rapprocher notre roi du pion.
Mettre la Dame dans la diagonale arrière du pion avec un échec pour forcer le roi adverse à avancer vers le pion
Result:Mate 20", "puzzleFenStart" : "8/6K1/8/8/8/8/4pk2/7Q w - - 0 6", "puzzleMoves" : "", "puzzleVariations" : " ", "puzzleSolutionComment" : "Queen vs Pawn on the 6th Rank Rule : Lone Queen vs King and pawn on the 6th rank is almost always a win for the Queen. Queen vs Pawn on the 7th Rank Rule : This endgame is won by manoeuvring with the Queen so that black’s King is forced to step in front of it’s pawn. Since the pawn can’t move for a moment, the white King can take a safe step closer to the pawn’s position. This will be repeated until white’s King joins with its Queen to pick off the pawn. Rules :
A b/g/e/d-pawn on the 7th almost lose to a Queen.
A c/f-pawn on the 7th rank can draw against a Queen if the
A rook-pawn on the 7th rank is a draw if the stronger side’s King is far from the action.
Astuces :
Mettre le roi adverse en face du pion pour avancer notre roi vers ce pion.
Mettre la Dame en face du pion et avancer notre roi vers le pion.
Rapprocher notre roi du pion.
Utiliser le clouage du pion
Rapprocher notre roi du pion.
Mettre la Dame dans la diagonale arrière du pion avec un échec pour forcer le roi adverse à avancer vers le pion
", "firstMoveEnable" : "false"},
{ "puzzleTitle" : "#24 - King and two healthy pawn vs lone King Class B - Silman endgame", "puzzleInfo" : " Rule : two passed pawns, on the same rank but separated by one file, have the ability to defend themselves from attacks by the enemy King. /When the King attack one, push the other and the attacked pawn suddenly becomes poison! Black to move. Result:Mate 18", "puzzleFenStart" : "8/8/6k1/8/5P1P/8/8/K7 w - - 0 1", "puzzleMoves" : "", "puzzleVariations" : " ", "puzzleSolutionComment" : "Rule : two passed pawns, on the same rank but separated by one file, have the ability to defend themselves from attacks by the enemy King. /When the King attack one, push the other and the attacked pawn suddenly becomes poison! Black to move.", "firstMoveEnable" : "false"},
{ "puzzleTitle" : "#25 - 2 passed pawns separated by 2 files vs Lone King Class B - Silman endgame", "puzzleInfo" : " Rule : The result of King and two pawns on the same rank two files apart vs. Lone King usually depends on whether or not the stronger side can sacrifice one of his pawns, using the time gained to bring his King into the game and create a winning King and pawn vs. King position. Result:Mate 18", "puzzleFenStart" : "8/8/5k2/8/4P2P/8/8/7K w - - 9 1", "puzzleMoves" : "", "puzzleVariations" : " ", "puzzleSolutionComment" : "Rule : The result of King and two pawns on the same rank two files apart vs. Lone King usually depends on whether or not the stronger side can sacrifice one of his pawns, using the time gained to bring his King into the game and create a winning King and pawn vs. King position.", "firstMoveEnable" : "false"},
{ "puzzleTitle" : "#26 - 2 passed pawns separated by 2 files vs Lone King – Draw Class B - Silman endgame", "puzzleInfo" : " Rule : The result of King and two pawns on the same rank two files apart vs. Lone King usually depends on whether or not the stronger side can sacrifice one of his pawns, using the time gained to bring his King into the game and create a winning King and pawn vs. King position. Result:Draw", "puzzleFenStart" : "8/8/6k1/8/4P2P/8/8/7K b - - 0 51", "puzzleMoves" : "Kh5", "puzzleVariations" : " ", "puzzleSolutionComment" : "Rule : The result of King and two pawns on the same rank two files apart vs. Lone King usually depends on whether or not the stronger side can sacrifice one of his pawns, using the time gained to bring his King into the game and create a winning King and pawn vs. King position.", "firstMoveEnable" : "false"},
{ "puzzleTitle" : "#27 - 2 passed pawns separated by 2 files vs Lone King – Draw Class B - Silman endgame", "puzzleInfo" : " Rule : The result of King and two pawns on the same rank two files apart vs. Lone King usually depends on whether or not the stronger side can sacrifice one of his pawns, using the time gained to bring his King into the game and create a winning King and pawn vs. King position. Result:Draw", "puzzleFenStart" : "8/8/8/4P2k/7P/8/8/7K b - - 0 52", "puzzleMoves" : "Kg6", "puzzleVariations" : " ", "puzzleSolutionComment" : "Rule : The result of King and two pawns on the same rank two files apart vs. Lone King usually depends on whether or not the stronger side can sacrifice one of his pawns, using the time gained to bring his King into the game and create a winning King and pawn vs. King position.", "firstMoveEnable" : "false"},
{ "puzzleTitle" : "#28 - 2 passed pawns separated by 3 files vs Lone King Class B - Silman endgame", "puzzleInfo" : " Rule : if the pawns are three or more files apart (and not yet on the 5th rank), the defender loses unless he can immediatly capture one o the pawns. Result:Mate 15", "puzzleFenStart" : "8/8/5k2/8/3P3P/8/8/7K w - - 9 1", "puzzleMoves" : "", "puzzleVariations" : " ", "puzzleSolutionComment" : "Rule : if the pawns are three or more files apart (and not yet on the 5th rank), the defender loses unless he can immediatly capture one o the pawns.", "firstMoveEnable" : "false"},
{ "puzzleTitle" : "#29 - Rook + 2 connected pawns Vs Rook Class B - Silman endgame", "puzzleInfo" : " A Rook endgame where one side is up two connected passed pawns is usually, as you might imagine, a clear win . Surprisingly, it can be quite time consuming and success is often dependent on you knowing the key ideas, and on you avoiding the many stalemate tricks that are lurking in the shadows. Connected rook-pawns and knight-pawns is the hardest case. RULE
King, Rook, knight - pawn, and rook-pawn on the same side of the board vs. King and Rook give the defender some stalemate tricks thanks to the rook-pawn's eternal pain - in-the-ass factor.
The trick to making life easy in such positions is to advance your pawns together so your King has shelter, your pawns can defend one another, and blockades can be avoided-don't allow one pawn to mad! y charge down the board on its own!
Advance your pawns together so your King has shelter, your pawns can defend one another, and blockades can be avoided-don't allow one pawn to madly charge down the board on its own!
REMEMBER
In Rook endings it is always a good idea to put your Rook as far away from the enemy King as possible. This is called Checking Distance.
Make sure that your pawns can shield your King from checks!
USEFUL ADVICE
In this endgame, only push the pawn to h7 if you're 100% sure you've avoided the sacrificial stalemate tricks.
WARNING
Only move your h-pawn to h7 if you are 100% sure you have prevented the many stalemate tricks that are so commonly found in these positions! Don't forget the need for (yes, I'm repeating myself) patience !
Step-by-step winning process:
Advance your pawns together so your King has shelter, your pawns can defend one another, and blockades can be avoi ded-don't allow one pawn to madly charge down the board on its own !
Make sure your King and pawns are in close contact. As in most chess situations, a team effort is needed for a successful result.
Make sure that your pawns can shield your King from checks!
Be patient! Push the enemy King back slowly, always making sure the above conditions have been met.
Once you have forced the enemy King to the back rank, move your Rook (which should be on the 7th rank) a couple files to the side of your pawns.
Your plan now is to :
Place both your pawns on the 6th rank (forcing black's Rook to guard against back rank mates).
Bring your King to the 7th rank-your Rook on the 7th will prevent checks along that rank.
Give check by moving your Rook (protected by your King on the 7th rank!) to the 8th rank, forcing an exchange. The resulting King and two pawns vs. lone King endgame should be baby stuff for you at this point. Stalemate exemple :
Perpetuel with ennemy rook (no protection from rook or pawn).
Sacrifice of the rook to stalemate.
Personnal (Thibault) plan :
1. Use the King to protect Pawn
2. Use rook to keep enemy King away from the action and restrict his area. Let 2 columns between white Pawns and White King to allow your King to Zigzag in those 2 file to attack enemy Pawns.
3. Major plan : advance pawns on by one and use the King to protect them. Use the rook to keep the enemy away from the action, each time it’s possible, reduce enemy King number of rank → A must have, control rank between enemy King and white Pawns. Idea it to threat Back rank mate with 2 pawns on the 6th rank.
4. Final Position : all white pieces on the 6th rank → 2 pawns on the 6th rank + white King on the same rank protected by the rook.
Result: +12 CP", "puzzleFenStart" : "8/5k2/8/3R3P/5r2/8/6PK/8 w - - 0 1", "puzzleMoves" : "", "puzzleVariations" : " ", "puzzleSolutionComment" : "A Rook endgame where one side is up two connected passed pawns is usually, as you might imagine, a clear win . Surprisingly, it can be quite time consuming and success is often dependent on you knowing the key ideas, and on you avoiding the many stalemate tricks that are lurking in the shadows. Connected rook-pawns and knight-pawns is the hardest case. RULE
King, Rook, knight - pawn, and rook-pawn on the same side of the board vs. King and Rook give the defender some stalemate tricks thanks to the rook-pawn's eternal pain - in-the-ass factor.
The trick to making life easy in such positions is to advance your pawns together so your King has shelter, your pawns can defend one another, and blockades can be avoided-don't allow one pawn to mad! y charge down the board on its own!
Advance your pawns together so your King has shelter, your pawns can defend one another, and blockades can be avoided-don't allow one pawn to madly charge down the board on its own!
REMEMBER
In Rook endings it is always a good idea to put your Rook as far away from the enemy King as possible. This is called Checking Distance.
Make sure that your pawns can shield your King from checks!
USEFUL ADVICE
In this endgame, only push the pawn to h7 if you're 100% sure you've avoided the sacrificial stalemate tricks.
WARNING
Only move your h-pawn to h7 if you are 100% sure you have prevented the many stalemate tricks that are so commonly found in these positions! Don't forget the need for (yes, I'm repeating myself) patience !
Step-by-step winning process:
Advance your pawns together so your King has shelter, your pawns can defend one another, and blockades can be avoi ded-don't allow one pawn to madly charge down the board on its own !
Make sure your King and pawns are in close contact. As in most chess situations, a team effort is needed for a successful result.
Make sure that your pawns can shield your King from checks!
Be patient! Push the enemy King back slowly, always making sure the above conditions have been met.
Once you have forced the enemy King to the back rank, move your Rook (which should be on the 7th rank) a couple files to the side of your pawns.
Your plan now is to :
Place both your pawns on the 6th rank (forcing black's Rook to guard against back rank mates).
Bring your King to the 7th rank-your Rook on the 7th will prevent checks along that rank.
Give check by moving your Rook (protected by your King on the 7th rank!) to the 8th rank, forcing an exchange. The resulting King and two pawns vs. lone King endgame should be baby stuff for you at this point. Stalemate exemple :
Perpetuel with ennemy rook (no protection from rook or pawn).
Sacrifice of the rook to stalemate.
Personnal (Thibault) plan :
1. Use the King to protect Pawn
2. Use rook to keep enemy King away from the action and restrict his area. Let 2 columns between white Pawns and White King to allow your King to Zigzag in those 2 file to attack enemy Pawns.
3. Major plan : advance pawns on by one and use the King to protect them. Use the rook to keep the enemy away from the action, each time it’s possible, reduce enemy King number of rank → A must have, control rank between enemy King and white Pawns. Idea it to threat Back rank mate with 2 pawns on the 6th rank.
4. Final Position : all white pieces on the 6th rank → 2 pawns on the 6th rank + white King on the same rank protected by the rook.
", "firstMoveEnable" : "false"},
{ "puzzleTitle" : "#30 - Rook + 2 connected pawns Vs Rook Class B - Silman endgame", "puzzleInfo" : " Result:Mate 15", "puzzleFenStart" : "5k2/8/3R2PP/7K/8/8/8/5r2 w - - 1 17", "puzzleMoves" : "h7 Rh1+ Kg5 Ke7 Ra6 Kd7 g7 Rg1+ Kf4 Rf1+ Ke3 Kc7 g8=Q", "puzzleVariations" : " ", "puzzleSolutionComment" : "", "firstMoveEnable" : "false"},
{ "puzzleTitle" : "#31 - Rook vs bishop the wrong corner - De La Villa – 100 end games", "puzzleInfo" : " Rook vs bishop the wrong corner P39 de la villa. The ending Rook vs. Bishop is usually a draw. However, the defender has to be careful with some positions when the king is pushed to the edge of the board. This is especially dangerous when the king is pushed to the wrong corner. In a Rook vs. Bishop ending, the wrong corner is the corner of the same colour as the squares on which the bishop moves. Result:Mate 19", "puzzleFenStart" : "6k1/5R2/6K1/8/8/8/8/6b1 w - - 0 1", "puzzleMoves" : "", "puzzleVariations" : " ", "puzzleSolutionComment" : "Rook vs bishop the wrong corner P39 de la villa. The ending Rook vs. Bishop is usually a draw. However, the defender has to be careful with some positions when the king is pushed to the edge of the board. This is especially dangerous when the king is pushed to the wrong corner. In a Rook vs. Bishop ending, the wrong corner is the corner of the same colour as the squares on which the bishop moves.", "firstMoveEnable" : "false"},
{ "puzzleTitle" : "#32 - Rook vs bishop right corner - De La Villa – 100 end games", "puzzleInfo" : " The other corner is a completely different story. It is so easy to defend this ending from the right corner that going there straight away is a perfectly sound idea. Position 1.18 The black king stands in the corner, while the bishop is ready to interpose on g8 in case of a check. Then White would have to let the bishop move to avoid stalemate, and the position wouldbe repeated. There are no serious winning chances. Result:Draw", "puzzleFenStart" : "7k/R7/7K/8/8/1b6/8/8 b - - 0 1", "puzzleMoves" : "", "puzzleVariations" : " ", "puzzleSolutionComment" : "The other corner is a completely different story. It is so easy to defend this ending from the right corner that going there straight away is a perfectly sound idea. Position 1.18 The black king stands in the corner, while the bishop is ready to interpose on g8 in case of a check. Then White would have to let the bishop move to avoid stalemate, and the position wouldbe repeated. There are no serious winning chances.", "firstMoveEnable" : "false"},
{ "puzzleTitle" : "#33 - Rook vs night at the edge of the board - De La Villa – 100 end games", "puzzleInfo" : " When fighting against a rook, the knight may have more trouble than the bishop. Nevertheless,most positions are drawn.In this ending, keeping the knight close to the king is the best policy. If the knight is separated from the king, it can be lost. Result:Draw", "puzzleFenStart" : "8/8/8/8/8/3k4/r7/3NK3 w - - 0 1", "puzzleMoves" : "", "puzzleVariations" : " ", "puzzleSolutionComment" : "When fighting against a rook, the knight may have more trouble than the bishop. Nevertheless,most positions are drawn.In this ending, keeping the knight close to the king is the best policy. If the knight is separated from the king, it can be lost.", "firstMoveEnable" : "false"},
{ "puzzleTitle" : "#34 - Rook vs knight or king in the corner - De La Villa – 100 end games", "puzzleInfo" : " Things are radically different when the king and the knight are at one corner of the board, no matter who occupies the corner-square. Their mobility is then restricted and the position becomes immediately lost. Even if the knight occupies the g2-square (an especially unfortunate square for the knight) most cases result in a defeat. There is no need for a deep analysis and it does not matter which side is to move: in all these positions White loses the knight straight away. The third diagram is especially impressive: the knight is not even on the edge of the board, but it is lost anyway. This is our first example of a ‘knight’s dumb square’ and its effects, but it will not be the last. Conclusion: In the battle Knight vs. Rook there are two scenarios the defender should avoid:
1. The knight is separated from the king.
2. Both pieces are trapped in the corner (even if the knight is on the g2-square).
Result:Draw", "puzzleFenStart" : "r7/8/8/8/8/6k1/6N1/7K w - - 0 1", "puzzleMoves" : "", "puzzleVariations" : " ", "puzzleSolutionComment" : "Things are radically different when the king and the knight are at one corner of the board, no matter who occupies the corner-square. Their mobility is then restricted and the position becomes immediately lost. Even if the knight occupies the g2-square (an especially unfortunate square for the knight) most cases result in a defeat. There is no need for a deep analysis and it does not matter which side is to move: in all these positions White loses the knight straight away. The third diagram is especially impressive: the knight is not even on the edge of the board, but it is lost anyway. This is our first example of a ‘knight’s dumb square’ and its effects, but it will not be the last. Conclusion: In the battle Knight vs. Rook there are two scenarios the defender should avoid:
1. The knight is separated from the king.
2. Both pieces are trapped in the corner (even if the knight is on the g2-square).
", "firstMoveEnable" : "false"},
{ "puzzleTitle" : "#35 - Rook vs knight or king in the corner - De La Villa – 100 end games", "puzzleInfo" : " Things are radically different when the king and the knight are at one corner of the board, no matter who occupies the corner-square. Their mobility is then restricted and the position becomes immediately lost. Even if the knight occupies the g2-square (an especially unfortunate square for the knight) most cases result in a defeat. There is no need for a deep analysis and it does not matter which side is to move: in all these positions White loses the knight straight away. The third diagram is especially impressive: the knight is not even on the edge of the board, but it is lost anyway. This is our first example of a ‘knight’s dumb square’ and its effects, but it will not be the last. Conclusion: In the battle Knight vs. Rook there are two scenarios the defender should avoid:
1. The knight is separated from the king.
2. Both pieces are trapped in the corner (even if the knight is on the g2-square).
Result:Mate -3", "puzzleFenStart" : "8/8/8/8/8/6k1/r7/6NK w - - 0 1", "puzzleMoves" : "", "puzzleVariations" : " ", "puzzleSolutionComment" : "Things are radically different when the king and the knight are at one corner of the board, no matter who occupies the corner-square. Their mobility is then restricted and the position becomes immediately lost. Even if the knight occupies the g2-square (an especially unfortunate square for the knight) most cases result in a defeat. There is no need for a deep analysis and it does not matter which side is to move: in all these positions White loses the knight straight away. The third diagram is especially impressive: the knight is not even on the edge of the board, but it is lost anyway. This is our first example of a ‘knight’s dumb square’ and its effects, but it will not be the last. Conclusion: In the battle Knight vs. Rook there are two scenarios the defender should avoid:
1. The knight is separated from the king.
2. Both pieces are trapped in the corner (even if the knight is on the g2-square).
/* ************'+"PuzzleList "+k+" title:" + currentPuzzlesListTemp.title+" *************** */";
for (var i = 0; i < currentPuzzlesListTemp.puzzles.length; i++) {
puzzle = currentPuzzlesListTemp.puzzles[i];
console.log("#"+i+" puzzleTitle:" + puzzle.puzzleTitle);
fen = puzzle.puzzleFenStart;
var fenTrim = fen.trim();
if(fen.length>fenTrim.length){
nbErrors=nbErrors+1;
errorsMsg+="\n ErrorA "+nbErrors+" on puzzle #"+i+" '"+currentPuzzlesListTemp.title+"' PuzzleTitle:'"+puzzle.puzzleTitle+"' puzzleInfo;"+puzzle.puzzleInfo+" Fen '"+fen+"' avec espace";
}
var fenSplit = fen.trim().split(" ");
var lastFenVal = fenSplit[fenSplit.length-1];
var lastFenValIsInteger = isNumeric(lastFenVal);
if(fen.indexOf('-')==-1 || !lastFenValIsInteger ){
nbErrors=nbErrors+1;
if(!lastFenValIsInteger){
errorsMsg+="\n Error Fen1 "+nbErrors+" on puzzle #"+i+" '"+currentPuzzlesListTemp.title+"' PuzzleTitle:'"+puzzle.puzzleTitle+"' puzzleInfo;"+puzzle.puzzleInfo+" Fen '"+fen+"' KO | lastFenVal='"+lastFenVal+"' lastFenValIsInteger="+lastFenValIsInteger;
}else{
errorsMsg+="\n Error Fen2 "+nbErrors+" on puzzle #"+i+" '"+currentPuzzlesListTemp.title+"' PuzzleTitle:'"+puzzle.puzzleTitle+"' puzzleInfo;"+puzzle.puzzleInfo+" Fen '"+fen+"' KO";
}
}
allFen+=' //'+"#"+i+" puzzleTitle:" + puzzle.puzzleTitle;
allFen+=' '+fen;
moves = puzzle.puzzleMoves;
movesTab = moves.split(" ");
numberFenExpected+=movesTab.length;
console.log("#"+i+" numberFenExpected:" + numberFenExpected);
tmpGame = new Chess(fen);
for (var j = 0; j < movesTab.length; j++) {
move=movesTab[j];
if(move.length==0){continue;}//no moves in the puzzle (0 solution)
if(move.length>5 && !(move.indexOf('?')>0) && !(move.indexOf('!')>0) && !(move.indexOf('x')>0 && move.indexOf('=')>0 && move.indexOf('+')>0) && !(move.indexOf('x')>0 && move.indexOf('#')>0) && !(move.indexOf('x')>0 && move.indexOf('+')>0) && !(move.indexOf('x')>0 && move.indexOf('=')>0) ){
nbErrors++;
errorsMsg+="\n Error Move "+nbErrors+" on puzzle #"+i+" move:"+move+" '"+currentPuzzlesListTemp.title+"' PuzzleTitle:'"+puzzle.puzzleTitle+"' puzzleInfo;"+puzzle.puzzleInfo+" - i:"+i+" j:"+j+" k:"+k;
}
tmpGame.move(move);
subFen = tmpGame.fen();
if (tmpGame.game_over() == true) {
continue;
}
if(subFen==fen || fen=='8/8/8/8/8/8/8/8 w - - 0 1' || subFen=='8/8/8/8/8/8/8/8 w - - 0 1'){
nbErrors++;
errorsMsg+="\n Error SubFen "+nbErrors+" on puzzle #"+i+" '"+currentPuzzlesListTemp.title+"' PuzzleTitle:'"+puzzle.puzzleTitle+"' puzzleInfo;"+puzzle.puzzleInfo+"- i:"+i+" j:"+j+" k:"+k;
}
numFen++;
console.log("Puzzle "+i+"-"+j+" numFen="+numFen+" - PuzzleList "+k+" title:" + currentPuzzlesListTemp.title);
allFen+=';'+subFen;
}
}
}
if(errorsMsg.length>0){
console.log(errorsMsg);
alert(nbErrors+" errors : "+"\n"+errorsMsg);
}
//allFenCopy=allFen;
//allFenCopy=replaceAll(allFen, ' ', '\\n');
allFenCopy=replaceAll(allFen, ' ', '\n');
//CopyTextToClipboard(allFenCopy);
$("#idPuzzleSolution").html(numFen+" fen found! "+allFen);
$("#idPuzzleSolution").show();
}
function replaceAll(str, find, replace) {
return str.replace(new RegExp(find, 'g'), replace);
}
function majEngineAnalyze(fenToFind){
majStockfishAnalyze(fenToFind);
majLeelaChessZeroAnalyze(fenToFind);
}
var lastStockfishAnalyze="";
function majStockfishAnalyze(fenToFind){
console.log("majStockfishAnalyze Load "+stockfishAnalyze.length+" fen");
var line;
var analyseTable;
var findMv = false;
for (var i = 0; i < stockfishAnalyze.length; i++) {
line = stockfishAnalyze[i];
if(fenToFind == line[0]){
findMv=true;
console.log("majStockfishAnalyze Find FEN "+fenToFind);
analyseTable=tabToHtml(line, "Stockfish");
$("#idAnalyseStockfish").html("My Move Stockfish Analyse : "+analyseTable+" Last Opponent Move Stockfish Analyse : "+lastStockfishAnalyze);
break;
}
}
if(findMv==false){
$("#idAnalyseStockfish").html("No Stockfish analyze found");
}
lastStockfishAnalyze=analyseTable;
}
function majLeelaChessZeroAnalyze(fenToFind2){
console.log("majLeelaChessZeroAnalyze Load "+leelaChessZeroAnalyze.length+" fen");
var line2;
var analyseTable2;
var findMv2 = false;
for (var i = 0; i < leelaChessZeroAnalyze.length; i++) {
line2 = leelaChessZeroAnalyze[i];
if(fenToFind2 == line2[0]){
findMv2=true;
console.log("majLeelaChessZeroAnalyze Find FEN "+fenToFind2);
analyseTable2=tabToHtml(line2, "Leela Chess Zero");
$("#idAnalyseLeelaChessZero").html("My Move Leela Chess Zero Analyse : "+analyseTable2);
break;
}
}
if(findMv2==false){
$("#idAnalyseLeelaChessZero").html("No Leela Chess Zero analyze found");
}
}
var findMoveInMasterDb = function() {
var findGames = false;
var fenToSearch=game.fen().substr(0,game.fen().indexOf(' '));
console.log('Master db info ='+mastersGamesDbInfo);
console.log('Master db ='+openingMastersUCI.length+' moves');
for (i = 0; i < openingMastersUCI.length; i++) {
if(openingMastersUCI[i][0]==fenToSearch){
console.log('find fen in chess master DB ');
//mastergames.html(openingMastersUCI[i][1]);
$("#idPuzzleMasterStat").html("Master Stat. : "+dbMasterStatToHtml(openingMastersUCI[i]));
findGames=true;
break;
}
}
if(findGames==false){$("#idPuzzleMasterStat").html('No master game found');}
generateOpeningInfo();
}
function dbMasterStatToHtml(masterMoves){
var masterMv;
var html = "";
console.log("dbMasterStatToHtml masterMoves='"+masterMoves+"'");
var masterFontSize = 28;
for (i = 0; i < masterMoves.length; i++) {
if(i==0){continue;}
masterMv = masterMoves[i];
console.log("dbMasterStatToHtml masterMv='"+masterMv+"'");
var move = masterMv[0];
var pourcentage = masterMv[1];
var nbOccurences = masterMv[2];
console.log("dbMasterStatToHtml move="+move+" pourcentage="+pourcentage+" nbOccurences="+nbOccurences);
if(pourcentage>19){
html=html
+""
+""+move+" "+pourcentage+"%("+nbOccurences+")";
}else if(pourcentage>9){
html=html
+""
+" "+move+" "+pourcentage+"%("+nbOccurences+")";
}else{
html=html+" "+move+" "+pourcentage+"%("+nbOccurences+")";
}
}
console.log("dbMasterStatToHtml html="+html);
return html;
}
function generateOpeningInfo(){
var findOpening=false;
var fenToSearch=game.fen().substr(0,game.fen().indexOf(' '));
console.log("generateOpeningInfo fenToSearch='"+fenToSearch+"'");
var htmlRes='';
var openningVar="";
for (i = 0; i < fenToEco.length; i++) {
var fen = fenToEco[i][0].substr(0,game.fen().indexOf(' '));
//console.log("fen='"+fen+"' fenToSearch='"+fenToSearch+"'");
if(fen==fenToSearch){
console.log('Find ECO : '+fenToEco[i]);
if(fenToEco[i][3].length>1){
openningVar=" > "+fenToEco[i][3];
}
htmlRes="ECO:"+fenToEco[i][1]+" > "+fenToEco[i][2]+openningVar+"";
console.log('Find ECO HTML='+htmlRes);
$('#openingInfoId').html(htmlRes);
findOpening=true;
break;
}
}
if(findOpening==false){
console.log("generateOpeningInfo Fen not found in Db");
$('#openingInfoId').html("");
}
//opningName
}
async function playMasterMoves(movesToPLay, speed){
console.log('playMasterMoves '+movesToPLay, " speed="+speed);
var currentBoardFen = game.fen();
game.move(movesToPLay, {sloppy: true});
board.position(game.fen());
await sleep(speed);
var findGames = false;
for (j = 0; j < 10; j++) {
var fenToSearch=game.fen().substr(0,game.fen().indexOf(' '));
for (i = 0; i < openingMastersUCI.length; i++) {
if(openingMastersUCI[i][0]==fenToSearch){
findGames=true;
console.log(i+'# find fen in chess master DB ');
game.move(openingMastersUCI[i][1][0], {sloppy: true});
board.position(game.fen());
await sleep(speed);
break;
}
}
if(findGames==false){
break;
}
await sleep(speed);
}
await sleep(7000);
board.position(currentBoardFen);
game= new Chess(currentBoardFen);
}
document.getElementById("movesToLoadId").onkeypress = function(event){
if (event.keyCode == 13 ){//|| event.which == 13){
console.log("movesToLoadId-You are pressed enter");
// if($(this).val().indexOf(" ")>0){
//split n moves
// }else{
PlayMoves();
// }
$(this).val('');
}
};
document.getElementById("fenToLoadId").onkeypress = function(event){
if (event.keyCode == 13 ){//|| event.which == 13){
console.log("fenToLoadId-You are pressed enter");
LoadFenToCreatePuzzle();
}
};
function ReversePuzzleOrder(){
allPuzzles.puzzles.reverse();
iniPuzzleList();
numCurrPuzzle=0;
numCurrMove=0;
loadPuzzle(numCurrPuzzle);
chronoReset();
}
function puzzleCreator(){
$("#idBuildPuzzle").toggle();
$("#idAnalyseStockfish").hide();
$("#idAnalyseLeelaChessZero").hide();
$("#idPuzzleMasterStat").hide();
$("#idPuzzleSolution").hide();
$("#idTitle").html("Puzzle creator");
}
function changeChessBoardSize(size){
console.log('Change chessnboard size to '+size+' px');
document.getElementById('board').style='width:'+size+'px;float: none !important;margin-left: auto;margin-right: auto;'
board.resize();
}
function CopyTextToClipboard() {
// Create a "hidden" input
var aux = document.createElement("input");
// Assign it the value of the specified element
var fenToCopy = game.fen();
aux.setAttribute("value", fenToCopy);
// Append it to the body
document.body.appendChild(aux);
// Highlight its content
aux.select();
// Copy the highlighted text
document.execCommand("copy");
// Remove it from the body
document.body.removeChild(aux);
alert('FEN '+fenToCopy+' copied to clipboard !' );
}
function CopyTextToClipboardFromVar(txtToCopy) {
// Create a "hidden" input
var aux = document.createElement("input");
// Assign it the value of the specified element
aux.setAttribute("value", txtToCopy);
// Append it to the body
document.body.appendChild(aux);
// Highlight its content
aux.select();
// Copy the highlighted text
document.execCommand("copy");
// Remove it from the body
document.body.removeChild(aux);
alert('txtToCopy= '+txtToCopy+' copied to clipboard !' );
}
async function Play(movesToPLay, speed){
//var movesToPLay='c3b1 c2b2 h8g8 f1b1 b7b5 h1g1 e6c4 g2f1 f8f7 f1c4 b5c4 b2e2 c4c3 e2c4 d8f8 f2f4';
console.log('Play '+movesToPLay);
var currentBoardFen = game.fen();
const moves = movesToPLay.split(' ');
for (i = 0; i < moves.length; i++) {
var move = moves[i];
console.log('Play '+move);
var mvBoard = move.slice(0, 2) + "-" + move.slice(2);
console.log('mvBoard '+mvBoard);
game.move(move, {sloppy: true});
board.position(game.fen());
await sleep(speed);
}
await sleep(7000);
board.position(currentBoardFen);
game= new Chess(currentBoardFen);
}
function sleep(ms) {
return new Promise(resolve => setTimeout(resolve, ms));
}
function tabToHtml(myTab, engine){
// ["5rBk/5pp1/5q2/8/8/8/2Q5/4K2R b K - 1 1",
// [[1,1,"Mate -2","f6h6",27,"f6h6 h1h6 g7h6 c2h7"]
// ,[2,2,"Mate -2","f6h4",27,"f6h4 h1h4 h8g8 c2h7"]
// ,[3,3,"Mate -1","h8g8",27,"h8g8 c2h7"]]],
console.log('tabToHtml myTab='+myTab);
var allMoves = myTab[1];
var tab="
FEN
"+myTab[0]
+"
Next "+engine+" best moves :("+allMoves[0][6]+" | version:"+ allMoves[0][7]+" | Net:"+ allMoves[0][8]+")
#
Move
CP
Depth
Next engine moves
";
var colorStyle
for (i = 0; i < allMoves.length; i++) {
var mvCp = allMoves[i][2];
var mvDepth = allMoves[i][4];
var engineVersion = "engine:"+ allMoves[i][6]+" version:"+ allMoves[i][7]+" Network:"+ allMoves[i][8];
if(i>2){
tab+="